<?php
/* @var $this MenuadminController */
/* @var $model Menuadmin */

$this->breadcrumbs=array(
	'Thêm quyền',
);
?>
<div class="form" id="<?php echo Yii::app()->controller->id . '-' . Yii::app()->controller->action->id?>">

<?php $form=$this->beginWidget('CActiveForm', array(
	'id'=>Yii::app()->controller->id . '_' . Yii::app()->controller->action->id,
	'enableAjaxValidation'=>false,
   'enableClientValidation'=>true,
   'htmlOptions' => array(
      'class' => 'form-horizontal',
   ),
)); ?>
   <p class="note">Những dòng đánh dấu <span class="required">*</span> là bắt buộc.</p>
	<?php echo $form->errorSummary($model,'Kiểm tra lại các giá trị bạn vừa nhập vào'); 
      if($message != ''){
         echo CHtml::tag('div', array('class'=>'message-success'),$message);
      }
   ?>
   
   <input name="session_user" type="hidden" value="<?php echo $session_user?>"/>
   <input name="action_user" type="hidden" value="" id="action_user" />
   <div class="control-group">
      <?php echo $form->labelEx($model, 'MemberGroupID',array('class' => 'control-label'));?>
      <div class="controls">
         <?php echo $form->dropDownList($model, 'MemberGroupID',$groupList);?>
      </div>
   </div>
   
   <div class="control-group">
      <?php echo $form->labelEx($model, 'MenuAdminID',array('class' => 'control-label'));?>
      <div class="controls">
         <?php echo $form->dropDownList($model, 'MenuAdminID',$menu_tree);?>
      </div>
   </div>
   <div class="control-group">
      <?php echo CHtml::label('Quyền','',array('class' => 'control-label'));?>
      <div class="controls">
            <?php echo Chtml::checkBox('check_all_role',false,array('id' => 'check_all_role'))?>
            <?php echo CHtml::label("Tất cả","check_all_role",array("style" => "color:#ff0000"))?>
            <?php echo $form->checkBox($model, 'IsView',array('class' => 'row-check-role'))?>
            <?php echo $form->labelEx($model, 'IsView');?>
            
            <?php echo $form->checkBox($model, 'IsAdd',array('class' => 'row-check-role'))?>
            <?php echo $form->labelEx($model, 'IsAdd');?>
            
            <?php echo $form->checkBox($model, 'IsEdit',array('class' => 'row-check-role'))?>
            <?php echo $form->labelEx($model, 'IsEdit');?>
           
            <?php echo $form->checkBox($model, 'IsDelete',array('class' => 'row-check-role'))?>
            <?php echo $form->labelEx($model, 'IsDelete');?>
            
            <?php echo $form->checkBox($model, 'IsActive',array('class' => 'row-check-role'))?>
            <?php echo $form->labelEx($model, 'IsActive');?>
            
            <?php echo $form->checkBox($model, 'IsPublish',array('class' => 'row-check-role'))?>
            <?php echo $form->labelEx($model, 'IsPublish');?>
            
            <?php echo $form->checkBox($model, 'IsExport',array('class' => 'row-check-role'))?>
            <?php echo $form->labelEx($model, 'IsExport');?>
            
            <?php echo $form->checkBox($model, 'IsImport',array('class' => 'row-check-role'))?>
            <?php echo $form->labelEx($model, 'IsImport');?>
      </div>
   </div>
   <div class="form-actions">
      <?php echo CHtml::submitButton('Lưu',array('class' => 'btn btn-info'))?>
      <?php echo CHtml::resetButton('Hủy',array('class' => 'btn btn-warning' ,'onclick' => 'window.history.go(-1)'))?>
	</div>
</div>
<?php $this->endWidget(); ?>
<script>
   $(document).ready(function(){
      //Select all record
      $("#check_all_role").click(function(){
         var checkboxes = $(".row-check-role");
         if($(this).is(':checked')) {
            checkboxes.attr('checked', 'checked');
         } else {
            checkboxes.removeAttr('checked');
         }
      });
   });
</script>